import {BrowserWindow,ipcMain} from 'electron'
//统一这里注册渲染接口
export const registerIpcMain = { //导出
    init(mainWindow:BrowserWindow){
        //IPC 测试接口,可传参
        ipcMain.on('uoload',(_event,file) => {
            console.log('uoload')
            console.log(file)
            //返回值，赋值给_event.returnValue即可
            _event.returnValue = "上传成功";
        }),

        //IPC测试接口,可传参
        ipcMain.on('push-message',(_event,message) => {
            console.log(message)
            //推送信息到receive-message
            setInterval(()=>{
                //mainWindow.webContents可推送信息到主题
                mainWindow.webContents.send('receive-message', '11111');
            }, 1000);
        })
    }
}